package com.zhoukx.decorator;

/**
 * @ClassName Decorator
 * @Description: 装饰类
 * @Author zhoukx
 * @Date 2020/8/10
 **/
public class Decorator extends Drink {

    private Drink obj;

    public Decorator(Drink obj) {
        this.obj = obj;
    }

    @Override
    public float cost() {
        // getPrice 是自己的价格
        return super.getPrice() + obj.cost();
    }

    @Override
    public String getDes() {
        //obj.getDes() 输出的是被装饰者的信息
        return super.des+ " " +super.getPrice()+"&&"+obj.getDes()+ " "+ obj.getPrice();
    }
}
